import mypipe_lib
import os
import sys
import time


#ff = open ('fifo', 'w')

count = 0
with open('/tmp/chiasyncpi', 'w') as ff:
    ff.write("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
print("aaa")

while True:
    msg = "cccddd" + str(count)
    mypipe_lib.pipe_write("/tmp/chiasyncpi", msg)
    count += 1
    time.sleep(1)

'''
while True:
    tstr = str(time.time())
    cmd = "echo " + tstr + ">" + "fifo"
    #os.system(cmd)
    #ff.write(str(time.time()))
    #ff.flush()
    with open ('fifo', 'w') as ff:
        ff.write(tstr)
    print ("aaa")

    time.sleep(1)
'''